import request from "@/utils/request";

/**
 * 获取店铺接口
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getOrderAccountList(params = {}){
  return request({
    url: '/order/getAccountList',
    method: 'get',
    params
  })

}

/**
 * 获取订单的列表数据
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getOrderList(params = {}){
  return request({
    url: '/order/getOrderList',
    method: 'get',
    params,
  })
}

/**
 * 获取falabella的订单数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getFaOrderList(params = {}){
  return request({
    url: '/order/getFaOrderList',
    method: 'get',
    params,
  })
}

/**
 * 获取falabella的订单数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getSpOrderList(params = {}){
  return request({
    url: '/order/getSpOrderList',
    method: 'get',
    params,
  })
}

/**
 * 获取shein的订单数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getSiOrderList(params = {}){
  return request({
    url: '/order/getSiOrderList',
    method: 'get',
    params,
  })
}

/**
 * 获取aliexpress的订单数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getAliexpressOrderList(params = {}){
  return request({
    url: '/order/getAliexpressOrderList',
    method: 'get',
    params,
  })
}

export function getTikTokOrderList(params = {}){
  return request({
    url: '/order/getTikTokOrderList',
    method: 'get',
    params,
  })
}

export function getOrder(orderId){
  return request({
    url: `/order/${orderId}`,
    method: 'get',
  })
}

/**
 * 获取订单列表数量
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getOrderListNum(params = {}){
  return request({
    url: `/order/getOrderListNum`,
    method: 'get',
    params,
  })
}

/**
 * 获取订单的聚合模块数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getOrderGoodsNum(params){
  return request({
    url: '/order/getOrderGoodsNum',
    params
  })
}


/**
 * 获取平台订单数量
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getOrderPlatformNum(params = {}){
  return request({
    url: '/order/getOrderPlatformNum',
    params,
  })
}

/**
 * 获取希音图片材料列表
 * @returns {Promise | Promise<unknown>}
 */
export function getSiAccountImageList(params){
  return request({
    url: '/order/getSiAccountImageList',
    params
  })
}

/**
 * 下载希音图片
 * @returns {Promise | Promise<unknown>}
 */
export function downloadSheinImgZip(params){
  return request({
    url: '/order/downloadSheinImgZip',
    params,
    responseType: 'blob',
    isNotJson:true,
    timeout: 60000 * 5, // 1分钟
    handleError: true,
  })
}

/**
 * 获取物流的轨迹
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getLogisticOrderTrace(params){
  return request({
    url: '/order/getLogisticOrderTrace',
    method: 'post',
    params,
    timeout: 60000 * 5, // 1分钟
  })

}

/**
 * 修改收件信息
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function saveReceivingInformation(params){
  return request({
    url: '/order/saveReceivingInformation',
    method: 'post',
    params,
  })
}

/**
 * 获取授权于用户的仓库列表
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getUserBelongWarehouseList(params = {}){
  return request({
    url: `/order/getUserBelongWarehouseList`,
    method: 'get',
    params,
  })
}
